package com.hehe.Config;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.ModelAttribute;

//  重要
@ControllerAdvice
public class GlobalModelAttribute {


    @ModelAttribute("logged_User_Id")
    public String get_User_Id(@CookieValue(value = "logged_User_Id", defaultValue = "") String logged_User_Id) {
        return logged_User_Id.isEmpty() ? null : logged_User_Id;
    }


    @ModelAttribute("logged_User_Nickname")
    public String get_User_Nickname(@CookieValue(value = "logged_User_Nickname", defaultValue = "") String logged_User_Nickname) {
        return logged_User_Nickname.isEmpty() ? null : logged_User_Nickname;
    }


}
